package com.zjgsu.coursecalendar.controller;

import com.zjgsu.coursecalendar.model.Homework;
import com.zjgsu.coursecalendar.service.TeacherService;
import com.zjgsu.coursecalendar.template.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TeacherContronller {

    @Autowired
    private TeacherService teacherService;
    //课程作业详细信息
    @RequestMapping("/homework")
    public ResultBean homework(int courseId, int weekId){
        ResultBean resultBean=new ResultBean();
        resultBean.setData(teacherService.getHomework(courseId,weekId));
        return resultBean;
    }

    //课程作业上交人数
    @RequestMapping("/homeworkuser")
    public int homewworkUsernum(int courseId, int weekId){
        Homework homework = new Homework();
        homework = teacherService.getHomework(courseId,weekId);
        int num = 0;
        num = teacherService.getHomewworkUsernumber(teacherService.getHomeworkUser(homework.getHomeworkId()));
        return num;
    }
}
